<template>
  <div id="viewFile"></div>
</template>
<script>
import * as WPS from '@/utils/jwps.es6'
export default {
  props: ['wpsUrl', 'token'],
  data() {
    return {
      // 是否开启简易模式
      simpleMode: true
    }
  },
  mounted() {
    this.openWps(this.wpsUrl, this.token);
  },
  methods: {
    openWps(url, token) {
      let _this = this;
      const wps = WPS.config({
        mode: _this.simpleMode ? 'simple' : 'normal',
        mount: document.querySelector('#app'),
        wpsUrl: url,
      });
      wps.setToken({ "token": token });
      let app = wps.Application;
      console.log(JSON.stringify(app))
    }
  }
}
</script>
<style>
#wps-iframe {
  display: flex;
  flex-direction: column;
  padding: 0;
  margin: 0;
  height: 100%;
  /* 防止双击缩放 */
  touch-action: manipulation;
}
</style>

